<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>飞书授权成功</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        
        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            min-height: 100vh;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 20px;
        }
        
        .container {
            background: white;
            border-radius: 20px;
            box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
            padding: 40px;
            text-align: center;
            max-width: 500px;
            width: 100%;
            animation: slideUp 0.6s ease-out;
        }
        
        @keyframes slideUp {
            from {
                opacity: 0;
                transform: translateY(30px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }
        
        .success-icon {
            width: 80px;
            height: 80px;
            background: #28a745;
            border-radius: 50%;
            margin: 0 auto 20px;
            display: flex;
            align-items: center;
            justify-content: center;
            animation: bounce 0.8s ease-out 0.2s both;
        }
        
        @keyframes bounce {
            0%, 20%, 53%, 80%, 100% {
                transform: translate3d(0, 0, 0);
            }
            40%, 43% {
                transform: translate3d(0, -10px, 0);
            }
            70% {
                transform: translate3d(0, -5px, 0);
            }
            90% {
                transform: translate3d(0, -2px, 0);
            }
        }
        
        .checkmark {
            color: white;
            font-size: 40px;
            font-weight: bold;
        }
        
        h1 {
            color: #333;
            font-size: 28px;
            margin-bottom: 15px;
            font-weight: 600;
        }
        
        .subtitle {
            color: #666;
            font-size: 16px;
            margin-bottom: 30px;
            line-height: 1.5;
        }
        
        .info-box {
            background: #f8f9fa;
            border-radius: 10px;
            padding: 20px;
            margin: 20px 0;
            text-align: left;
        }
        
        .info-item {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 10px;
            padding: 8px 0;
            border-bottom: 1px solid #e9ecef;
        }
        
        .info-item:last-child {
            border-bottom: none;
            margin-bottom: 0;
        }
        
        .info-label {
            font-weight: 600;
            color: #495057;
        }
        
        .info-value {
            color: #6c757d;
            font-family: 'Courier New', monospace;
            font-size: 14px;
            word-break: break-all;
        }
        
        .status {
            display: inline-block;
            padding: 6px 12px;
            border-radius: 20px;
            font-size: 14px;
            font-weight: 600;
            color: white;
            background: {{TOKEN_COLOR}};
        }
        
        .next-steps {
            background: #e3f2fd;
            border-left: 4px solid #2196f3;
            padding: 15px;
            margin: 20px 0;
            text-align: left;
            border-radius: 0 8px 8px 0;
        }
        
        .next-steps h3 {
            color: #1976d2;
            margin-bottom: 10px;
            font-size: 16px;
        }
        
        .next-steps ul {
            color: #424242;
            padding-left: 20px;
        }
        
        .next-steps li {
            margin-bottom: 5px;
        }
        
        .close-btn {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            border: none;
            padding: 12px 30px;
            border-radius: 25px;
            font-size: 16px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.3s ease;
            margin-top: 20px;
        }
        
        .close-btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
        }
        
        .footer {
            margin-top: 30px;
            padding-top: 20px;
            border-top: 1px solid #e9ecef;
            color: #6c757d;
            font-size: 14px;
        }
    </style>
</head>
<body>
    <div class="container">
        <div class="success-icon">
            <div class="checkmark">✓</div>
        </div>
        
        <h1>授权成功！</h1>
        <p class="subtitle">我们已经成功获取到您的飞书授权码</p>
        
        <div class="info-box">
            <div class="info-item">
                <span class="info-label">授权码:</span>
                <span class="info-value">{{AUTH_CODE_DISPLAY}}</span>
            </div>
            <div class="info-item">
                <span class="info-label">获取时间:</span>
                <span class="info-value">{{CURRENT_TIME}}</span>
            </div>
            <div class="info-item">
                <span class="info-label">令牌状态:</span>
                <span class="status">{{TOKEN_STATUS}}</span>
            </div>
        </div>
        
        <div class="next-steps">
            <h3>🎉 接下来您可以:</h3>
            <ul>
                <li>关闭此页面，返回应用程序</li>
                <li>运行 <code>python run_example.py</code> 测试API</li>
                <li>运行 <code>python goods_manager.py</code> 管理商品</li>
                <li>查看 <code>feishu_tokens.json</code> 文件中的令牌信息</li>
            </ul>
        </div>
        
        <button class="close-btn" onclick="window.close()">关闭页面</button>
        
        <div class="footer">
            <p>🚀 飞书多维表格API客户端</p>
            <p>此页面将在几秒后自动关闭</p>
        </div>
    </div>
    
    <script>
        // 5秒后自动关闭页面
        setTimeout(function() {
            window.close();
        }, 5000);
        
        // 复制授权码功能
        document.querySelector('.info-value').addEventListener('click', function() {
            navigator.clipboard.writeText('{{FULL_AUTH_CODE}}').then(function() {
                alert('授权码已复制到剪贴板！');
            });
        });
    </script>
</body>
</html>